/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.thienloc.omap.entity;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author GiangLT
 */
@Entity
@Table(name = "GIAI_THUONG", catalog = "")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "GiaiThuong.findAll", query = "SELECT g FROM GiaiThuong g"),
    @NamedQuery(name = "GiaiThuong.findById", query = "SELECT g FROM GiaiThuong g WHERE g.id = :id"),
    @NamedQuery(name = "GiaiThuong.findByTenGiai", query = "SELECT g FROM GiaiThuong g WHERE g.tenGiai = :tenGiai"),
    @NamedQuery(name = "GiaiThuong.findByBoSo1", query = "SELECT g FROM GiaiThuong g WHERE g.boSo1 = :boSo1"),
    @NamedQuery(name = "GiaiThuong.findByBoSo2", query = "SELECT g FROM GiaiThuong g WHERE g.boSo2 = :boSo2"),
    @NamedQuery(name = "GiaiThuong.findByBoSo3", query = "SELECT g FROM GiaiThuong g WHERE g.boSo3 = :boSo3"),
    @NamedQuery(name = "GiaiThuong.findByBoSo4", query = "SELECT g FROM GiaiThuong g WHERE g.boSo4 = :boSo4"),
    @NamedQuery(name = "GiaiThuong.findByBoSo5", query = "SELECT g FROM GiaiThuong g WHERE g.boSo5 = :boSo5"),
    @NamedQuery(name = "GiaiThuong.findByBoSo6", query = "SELECT g FROM GiaiThuong g WHERE g.boSo6 = :boSo6"),
    @NamedQuery(name = "GiaiThuong.findByGioKhoiTao", query = "SELECT g FROM GiaiThuong g WHERE g.gioKhoiTao = :gioKhoiTao"),
    @NamedQuery(name = "GiaiThuong.findByGioCapNhatCuoi", query = "SELECT g FROM GiaiThuong g WHERE g.gioCapNhatCuoi = :gioCapNhatCuoi"),
    @NamedQuery(name = "GiaiThuong.findByBoSo7", query = "SELECT g FROM GiaiThuong g WHERE g.boSo7 = :boSo7"),
    @NamedQuery(name = "GiaiThuong.findByBoSo8", query = "SELECT g FROM GiaiThuong g WHERE g.boSo8 = :boSo8")})
public class GiaiThuong implements Serializable {
    private static final long serialVersionUID = 1L;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Id
    @Basic(optional = false)
    @Column(name = "ID")
    private BigDecimal id;
    @Size(max = 40)
    @Column(name = "TEN_GIAI")
    private String tenGiai;
    @Size(max = 20)
    @Column(name = "BO_SO_1")
    private String boSo1;
    @Size(max = 20)
    @Column(name = "BO_SO_2")
    private String boSo2;
    @Size(max = 20)
    @Column(name = "BO_SO_3")
    private String boSo3;
    @Size(max = 20)
    @Column(name = "BO_SO_4")
    private String boSo4;
    @Size(max = 20)
    @Column(name = "BO_SO_5")
    private String boSo5;
    @Size(max = 20)
    @Column(name = "BO_SO_6")
    private String boSo6;
    @Column(name = "GIO_KHOI_TAO")
    @Temporal(TemporalType.TIMESTAMP)
    private Date gioKhoiTao;
    @Column(name = "GIO_CAP_NHAT_CUOI")
    @Temporal(TemporalType.TIMESTAMP)
    private Date gioCapNhatCuoi;
    @Size(max = 20)
    @Column(name = "BO_SO_7")
    private String boSo7;
    @Size(max = 20)
    @Column(name = "BO_SO_8")
    private String boSo8;
    @JoinColumn(name = "ID_KQXS", referencedColumnName = "ID")
    @ManyToOne
    private Kqxs idKqxs;

    public GiaiThuong() {
    }

    public GiaiThuong(BigDecimal id) {
        this.id = id;
    }

    public BigDecimal getId() {
        return id;
    }

    public void setId(BigDecimal id) {
        this.id = id;
    }

    public String getTenGiai() {
        return tenGiai;
    }

    public void setTenGiai(String tenGiai) {
        this.tenGiai = tenGiai;
    }

    public String getBoSo1() {
        return boSo1;
    }

    public void setBoSo1(String boSo1) {
        this.boSo1 = boSo1;
    }

    public String getBoSo2() {
        return boSo2;
    }

    public void setBoSo2(String boSo2) {
        this.boSo2 = boSo2;
    }

    public String getBoSo3() {
        return boSo3;
    }

    public void setBoSo3(String boSo3) {
        this.boSo3 = boSo3;
    }

    public String getBoSo4() {
        return boSo4;
    }

    public void setBoSo4(String boSo4) {
        this.boSo4 = boSo4;
    }

    public String getBoSo5() {
        return boSo5;
    }

    public void setBoSo5(String boSo5) {
        this.boSo5 = boSo5;
    }

    public String getBoSo6() {
        return boSo6;
    }

    public void setBoSo6(String boSo6) {
        this.boSo6 = boSo6;
    }

    public Date getGioKhoiTao() {
        return gioKhoiTao;
    }

    public void setGioKhoiTao(Date gioKhoiTao) {
        this.gioKhoiTao = gioKhoiTao;
    }

    public Date getGioCapNhatCuoi() {
        return gioCapNhatCuoi;
    }

    public void setGioCapNhatCuoi(Date gioCapNhatCuoi) {
        this.gioCapNhatCuoi = gioCapNhatCuoi;
    }

    public String getBoSo7() {
        return boSo7;
    }

    public void setBoSo7(String boSo7) {
        this.boSo7 = boSo7;
    }

    public String getBoSo8() {
        return boSo8;
    }

    public void setBoSo8(String boSo8) {
        this.boSo8 = boSo8;
    }

    public Kqxs getIdKqxs() {
        return idKqxs;
    }

    public void setIdKqxs(Kqxs idKqxs) {
        this.idKqxs = idKqxs;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof GiaiThuong)) {
            return false;
        }
        GiaiThuong other = (GiaiThuong) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(tenGiai);
        sb.append(": ");
        sb.append(boSo1 == null ? "" : boSo1 + "\t");
        sb.append(boSo2 == null ? "" : boSo2 + "\t");
        sb.append(boSo3 == null ? "" : boSo3 + "\t");
        sb.append(boSo4 == null ? "" : boSo4 + "\t");
        sb.append(boSo5 == null ? "" : boSo5 + "\t");
        sb.append(boSo6 == null ? "" : boSo6 + "\t");
        sb.append(boSo7 == null ? "" : boSo7 + "\t");
        sb.append(boSo8 == null ? "" : boSo8 + "\t");
        
        return sb.toString();
    }
    
}
